﻿Blockly.Blocks['Goertek_BuzzerControl'] = {
  init: function() {
    this.appendDummyInput()
	    .appendField("蜂鸣器控制 ")
		.appendField("频率")
		.appendField(new Blockly.FieldTextInput("0"), "freq")
		.appendField("音量")
		.appendField(new Blockly.FieldTextInput("0"), "vol");
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setColour(250);
    this.setTooltip('');
    this.setHelpUrl('http://www.example.com/');
  }
};
Blockly.Python['Goertek_BuzzerControl'] = function(block) {
  // TODO: Assemble Python into code variable.
  var text_mode = block.getFieldValue('freq');
  var text_freq = block.getFieldValue('vol');
  var code = 'Buzzer_atomic_contrl('+text_mode+','+text_freq+')'+'\n';
  return code;
};